var str = "I'm a student."

console.log(reverseString(str.split(' ')).join(' '))

function reverseString(str){
    for(var i = 0; i< str.length/2; i++){
        var tmp = str[i];
        str[i] = str[str.length - 1 -i];
        str[str.length - 1 -i] = tmp;
    }
    return str;
}
